﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SatisKarsilastirma
{
    public partial class frmMagazaTanitim : Form
    {
        List<Depo> Depolar;
        Mikro mikro = new Mikro();

        public frmMagazaTanitim()
        {
            InitializeComponent();
        }

        private void frmMagazaTanitim_Load(object sender, EventArgs e)
        {
            Depolar = mikro.ListDepo();
            dataGridView1.DataSource = Depolar;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            dataGridView1.AutoResizeColumns();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                FolderBrowserDialog dl = new FolderBrowserDialog();
                if (dl.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Depo depo = dataGridView1.CurrentRow.DataBoundItem as Depo;
                    depo.Yol = dl.SelectedPath;
                    dataGridView1.AutoResizeColumns();
                    dataGridView1.Refresh();
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (Depolar != null)
            {
                mikro.SaveDepo(Depolar);
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
